package com.dtt.learning;


import org.apache.tomcat.util.codec.binary.Base64;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;


/**
 * 应用的入口类
 *
 * <pre>
 * @SpringBootApplication 表示入口类注解
 *
 * @author luodongseu
 */
@SpringBootApplication
public class Application {

  /**
   * 运行该函数即可启动整个应用！！！
   *
   * <pre>
   * 应用的启动函数，该启动函数会启动内置tomcat。
   *
   * @param args
   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
      SpringApplication.run(Application.class, args);
//    String ls_args;
//    String appSecKey = "8297b2974a9f218d9a2225f8adff8054";
//    ls_args ="{'taxNo':'913201916790393658','invoiceType':'04','invoiceNo':'28632996','invoiceCode':'3200162130','invoiceDate':'20170419','invoiceAmount':'306324.00','checkCode':'123456'}";
//    String srcStr = "POST/recipt/checkFp/getFPInfoByNSRSBH?authorize={'appSecId':'1ff19043afdb8ac20272c2fab3304c78'}&globalInfo={'appId':'CYFP','version':'V1.0','interfaceCode':'CHECK.SINGLE','enterpriseCode':'SMDGJ','dataExchangeId':'SMDGJ20180621123456789'}&data="+ls_args;
//    SecretKeySpec keySpec = new SecretKeySpec(appSecKey.getBytes("UTF-8"),"HmacSHA1");
//    Mac mac = Mac.getInstance("HmacSHA1");
//    mac.init(keySpec);
//    byte[] signBytes = mac.doFinal(srcStr.getBytes("UTF-8"));
//    String appSec = Base64.encodeBase64String(signBytes);
//    System.out.println(appSec);
//    String appSec1 = Base64.encodeBase64String(ls_args.getBytes("UTF-8"));
//    System.out.println(appSec1);
//    String ls;
//    String ls2;
//    byte[] ls1;
//    ls="eyAiaW52b2ljZUxpc3QiOiBbeyJyZXN1bHRDb2RlIjoiMTAwNyIsInJlc3VsdFRpcCI6Iuetvuadg+Wksei0pSEifV19";
//    ls1 = Base64.decodeBase64(ls);
//
//    System.out.println(new String(ls1));
  }


}
